import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Hua YY
 * Date: 2025-03-03
 * Time: 15:05
 */
public class Test22 {
    public static int resultLength(int[] nums){
        int n = nums.length;
        int result = 0;

        for(int i = 0 ; i < n ; i++){
            int curLength = 0;
            int ret = nums[i];
            for(int j = i ; j < n ;){
                ret *= nums[j];
                if(ret > 0){
                    curLength = Math.max(curLength,j-i+1);
                    j++;
                }else if(ret < 0){
                    j++;
                }else {
                    break;
                }
            }
            result = Math.max(curLength,result);
        }
        return result;
    }

    public static void main(String[] args) {
        int[] nums = new int[]{1,-2,-3,4};
        System.out.println(resultLength(nums));
    }
}
